package com.it.boot.controller;

import com.it.boot.config.ApiResult;
import com.it.boot.entity.SysErrorLogEntity;
import com.it.boot.service.SysErrorLogService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Tag(name = "前端异常日志记录")
@Slf4j
@RestController
@RequestMapping("/api/errorLog")
public class SysErrorLogController {

    @Resource
    private SysErrorLogService sysErrorLogService;

    @PostMapping("create")
    public ApiResult<?> receiveError(@RequestBody SysErrorLogEntity entity) {
        sysErrorLogService.save(entity);
        return ApiResult.success();
    }
}